import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { MySeriveProvider } from '../../../providers/my-serive/my-serive';

/**
 * Generated class for the MemberPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-member',
  templateUrl: 'member.html'
})
export class MemberPage {
  evaluatingcode;
  allEval;

  constructor(
    public navCtrl: NavController,
    public navParams: NavParams,
    public mySerive: MySeriveProvider
  ) {}

  ionViewDidLoad() {}

  ionViewWillEnter() {
    this.evaluatingcode = this.navParams.get('evaluatingcode');
    let evaluating = { evaluatingcode: this.evaluatingcode };
    this.mySerive.getMember(evaluating).subscribe(data => {
      this.allEval = data;
    });

  }

  openSmitem(usercode) {
    this.navCtrl.push('BeEvaluatedPage', {
      usercode: usercode,
      evaluatingcode: this.evaluatingcode
    });
  }
}
